<?php
session_start();
$pid = addslashes($_GET['pid']);
if(empty($pid)){
	header('location:index.php');
	exit();
}
//Konfigurasi
include('../conf/setup.php');

//Library
include('../class.mamatblog/mysql.php');

define(IMPORT,'../class.mamatblog/',true);
require_once(IMPORT.'mysql.php');
require_once(IMPORT.'link.php');
require_once(IMPORT.'page.php');
require_once(IMPORT.'track.php');
require_once(IMPORT.'comment.php');	

//COntent
$comm = new Comment();
$page = new Page();
$pageDetail = $page->getPage($pid);
$cont = nl2br(str_replace('[/code]','</pre></div>',(str_replace('[code]','<div style="background-color:#ACB5F2;color:#000000;font-family:Courier, monospace;font-size:12px"><pre>',$pageDetail[0][3]))));
	
	$strSampleArtikel .="<h3>".$pageDetail[0][2]."</h3>
	<small><i>Posted on ".$pageDetail[0][1]." by ".$page->getPageAuthor($pageDetail[0][5]).", ".$comm->getCommentRows($pageDetail[0][0])." Comments</i></small>
<p>$cont<a href=\"pagedetail.php?pid=".$pageDetail[0][0]."\"></a></p>
";	
//Commentar
$strc = "<h3>Comment</3>";
$strc .="
<form id=\"form1\" name=\"form1\" method=\"post\" action=\"\">
  name: 
    <input name=\"name\" type=\"text\" size=\"15\" /> 
  <br/>email: 
  <input name=\"mail\" type=\"text\" size=\"25\" /> 
  website: 
  <input name=\"site\" type=\"text\" size=\"30\" />
<br/>
Code: <img src=\"../class.mamatblog/imgcreate.class.php\"> <input name=\"code\" type=\"text\" size=\"5\"/>
Comment:<br/>
    <textarea name=\"message\" cols=\"70\" rows=\"5\"></textarea>
</form>";

//Other application
$subTitle = $page->getPageTitle($pageDetail[0][4]);
$stro = "<h3>Other Articles</h3>";
$stro .="<ul>";
for($i = 0; $i < count($subTitle); $i++){
	$stro.="<li><a href=\"pagedetail.php?pid=".$subTitle[$i][0]."\">".$subTitle[$i][2]."</a> <small>".$page->getPageAuthor(		$subTitle[$i][4]).", ".$subTitle[$i][1]."</small></li>";
}
	
$stro .= "</ul>";

$strSampleArtikel.=$strSampleArtkel.$stro;

$smarty->assign('content',$strSampleArtikel);

include('menukiri.php');

//View
$smarty->display('index.tpl');
?>